UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'O0w8ptACy6Ed0nfb7rbCiL4+1cybiOUdnX6KOL5QJko=' 
WHERE 
  key_id = 'c2f1060c7c48b40f9fbba588f478720d71250814261d43fcfd3a58142d80d132' 
  AND (
    token = 'O0w8ptACy6Ed0nfb7rbCiL4+1cybiOUdnX6KOL5QJko=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00044