UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'tniunqkxCaTnSNET9jDcU0JXkTmno+LbLcc3Fgjk308=' 
WHERE 
  key_id = 'f8a3cce47db7bf454e32b2566141b5dbb340a9ec50b401434d690b4e3a090a28' 
  AND (
    token = 'tniunqkxCaTnSNET9jDcU0JXkTmno+LbLcc3Fgjk308=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028