UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'nwVJ1zeC3XEZfyhD2bQx16BYO7oYE9Ze2dF+rBLXXko=' 
WHERE 
  key_id = '6f772206e16d396a77cc0f8498634389d3f908f66b58c9b648659e6a40e9c457' 
  AND (
    token = 'nwVJ1zeC3XEZfyhD2bQx16BYO7oYE9Ze2dF+rBLXXko=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00041