UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Vr/uuiVPlPwTCgr62Iu8dRzVCZsrk0JvkLnOf2I6Z20=' 
WHERE 
  key_id = '2ca92277c6277d353df44494636e419f049737f407b8ea114e7d55026e44a5c4' 
  AND (
    token = 'Vr/uuiVPlPwTCgr62Iu8dRzVCZsrk0JvkLnOf2I6Z20=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00022