UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '7b1ZKfOG/BhLoG6aH5pNjIGqWRmDzikSMAcqxuZMX+s=' 
WHERE 
  key_id = '594f83ca93d6a7e88b0f7368c30f050beec0af63e476ab3872fb1ca4b4436568' 
  AND (
    token = '7b1ZKfOG/BhLoG6aH5pNjIGqWRmDzikSMAcqxuZMX+s=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026