UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'mWhBmvtozACa6gOcMA10pk2SkbuY9tQcwStmLNjsZdM=' 
WHERE 
  key_id = 'd9ab96cfccde8c3a75623be51e15f6f47a474db0e95b46525015b34bc3b23e49' 
  AND (
    token = 'mWhBmvtozACa6gOcMA10pk2SkbuY9tQcwStmLNjsZdM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00019