UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ZrFM0FQfAb5Irv7nKtBhi0FlxYFZXUctu+seO97VOFo=' 
WHERE 
  key_id = '0f3d99e2b960d099c78de16dcbc24f290856c3395b988fed57e6f9d873f208c5' 
  AND (
    token = 'ZrFM0FQfAb5Irv7nKtBhi0FlxYFZXUctu+seO97VOFo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00054