UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'L4xmuMAjSxw0eMoPS8GiChNLrMFZNmZD/q2dMFz+r7s=' 
WHERE 
  key_id = 'f37269184312425c68227ce3dae618cda9b54698617808ab268ff419aa355534' 
  AND (
    token = 'L4xmuMAjSxw0eMoPS8GiChNLrMFZNmZD/q2dMFz+r7s=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029