UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'StNCPi6513UfeXYwvuQ+dcIFrcOGhhXnJx1fcH6piIg=' 
WHERE 
  key_id = '8725a03ee44bfed1b18b112c76c6632967e8cbf2ba83a9fe61a57253d82d9454' 
  AND (
    token = 'StNCPi6513UfeXYwvuQ+dcIFrcOGhhXnJx1fcH6piIg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00042