UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'h7dW2DI8TJCjQba9d82hE5fm7AZ/ODBKY4s3OFxYTac=' 
WHERE 
  key_id = '8c9aa86629db75895ed452b5ec05b21e698d160f5d91939785825cdbb08f356f' 
  AND (
    token = 'h7dW2DI8TJCjQba9d82hE5fm7AZ/ODBKY4s3OFxYTac=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031