UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'mLFfVqc8uUnsp7SmFkGPdRwoKeJrnVawwPO0A+VZtFw=' 
WHERE 
  key_id = '04f8c1be609578850387ded4a83326cc280d4c801fc5bde16c14b4311e1ea514' 
  AND (
    token = 'mLFfVqc8uUnsp7SmFkGPdRwoKeJrnVawwPO0A+VZtFw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00021