UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'dBYboDsmkmWUU+pQ2W+DqF3yH6/znNICavtgzGhirw8=' 
WHERE 
  key_id = '87a05a1e316d6d4c6d6bab53348a447b2c61c917339f6c659b67f887b0b35d3c' 
  AND (
    token = 'dBYboDsmkmWUU+pQ2W+DqF3yH6/znNICavtgzGhirw8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023