UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'sViZub4hxzLsB1TTw+ES/LISUuOrgRAZ2sQ/Wp27BpI=' 
WHERE 
  key_id = '4c36fa35992452c9d505aa8e255fe4251ed5d444206932211a1cd25927a38dfd' 
  AND (
    token = 'sViZub4hxzLsB1TTw+ES/LISUuOrgRAZ2sQ/Wp27BpI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00065