UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'WBc0Eny4o2QCfpBLfB1z4rlqRaYvvuYR4iFPYMYAb4E=' 
WHERE 
  key_id = '086738d911fd7fac49bbf6f0760da8baf1347437e5c5e3d27ee33d5333370296' 
  AND (
    token = 'WBc0Eny4o2QCfpBLfB1z4rlqRaYvvuYR4iFPYMYAb4E=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00071