UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'gIQrZKxFOwukIuq9siJ+zOXw8klCWHstLE2jHcRhYII=' 
WHERE 
  key_id = '7ae3226b7b8c9ddbd5317f5300dbb461c2e9ea1093abeda8160424cc5d4aabeb' 
  AND (
    token = 'gIQrZKxFOwukIuq9siJ+zOXw8klCWHstLE2jHcRhYII=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00042