UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'XvL5fhEjsPzrXg1urOy0XHFoyII51cqMMX1D1058j4E=' 
WHERE 
  key_id = '6c2f0b71015aa583f0783697aeda8a93bc1947994fab8806671b7f2e07c9bb65' 
  AND (
    token = 'XvL5fhEjsPzrXg1urOy0XHFoyII51cqMMX1D1058j4E=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030