UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'cEdtLj1XdVg/df6gDfV1fZNkziwy3U96G5FKAi5tEps=' 
WHERE 
  key_id = '2caf853a09805f3ea0e75ff0a8f99dceb0bb0df2493a15401df477b82df9eb6b' 
  AND (
    token = 'cEdtLj1XdVg/df6gDfV1fZNkziwy3U96G5FKAi5tEps=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00014