UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'MLMW8xAy12PlOFHI7cr1CS5I8kK4KJQZ2mZY+QRa5D0=' 
WHERE 
  key_id = '073ee05c754aa8f3c7247e70de0dbd251bd8697389b40460acb51ea8b3db6a88' 
  AND (
    token = 'MLMW8xAy12PlOFHI7cr1CS5I8kK4KJQZ2mZY+QRa5D0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036