UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'RZdV8j9ULPSaoZbZ1z2mdE6HaR3pkkaTS01o+Hq1TjI=' 
WHERE 
  key_id = '85769f9a9f0f1d459a556082412bd95b2d7cdc10c9e5850291a84187432baf59' 
  AND (
    token = 'RZdV8j9ULPSaoZbZ1z2mdE6HaR3pkkaTS01o+Hq1TjI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038