UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '3VNPJ4t00BcAJaSiyea1eecANDkTbqwkAbfZdSZsyS8=' 
WHERE 
  key_id = '172cee892639502e0c36ee96dee98220d97ad906126d6349bfd9d2dc966d9949' 
  AND (
    token = '3VNPJ4t00BcAJaSiyea1eecANDkTbqwkAbfZdSZsyS8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00055