UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'wfTmOa3yH9UwlT+PT0VHytCuzMWuazNMngW9OiIOMdM=' 
WHERE 
  key_id = '1dce7593b87fc3a316384b7bd9a1cf0f61fadaf53a3d89dce5a65e004462a6cd' 
  AND (
    token = 'wfTmOa3yH9UwlT+PT0VHytCuzMWuazNMngW9OiIOMdM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029