UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Niulw9kMGzgyYOPSVZ+E6EJlucHuiXcJsSzs+XEUmt4=' 
WHERE 
  key_id = '3c2cb406c8af9ea7af77357dcdee3e96ee80d058ae44b28a06362f040c4d6ae8' 
  AND (
    token = 'Niulw9kMGzgyYOPSVZ+E6EJlucHuiXcJsSzs+XEUmt4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025