UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'PEYaoL+qj+EPLXGVRUXcGpIYoK54+R+J43U3Bn45/uU=' 
WHERE 
  key_id = 'ed09b752143e4edf8dc94f4f08d525e1d35af588f9d44c5b34a4ca04b13f51af' 
  AND (
    token = 'PEYaoL+qj+EPLXGVRUXcGpIYoK54+R+J43U3Bn45/uU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027