UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'e53M9UhlGy3Ak6q6pla5Aj3qMqgQQ1piIlgAe5kFAvM=' 
WHERE 
  key_id = '93117d79e4c54c7aaa3b243e84303c10cb2b2d9296bce4b0e2d0bce04fcc9b49' 
  AND (
    token = 'e53M9UhlGy3Ak6q6pla5Aj3qMqgQQ1piIlgAe5kFAvM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00054