UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'HPvXhnDQwJGUyNVpDNLca0QltnVsb6+vuXBWKKVx7N4=' 
WHERE 
  key_id = '0994f456f9b11158abae8e22bad55627c977643652db4b762d8cdb461b815603' 
  AND (
    token = 'HPvXhnDQwJGUyNVpDNLca0QltnVsb6+vuXBWKKVx7N4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027