UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'dhEu+4dJcyPj8dXCeq+fGBwowwRPiYsbp+TgfWN5UUs=' 
WHERE 
  key_id = 'd2cd203d3e77c70b587a845fa0f73dce39220e4738b43945383123928ae785fe' 
  AND (
    token = 'dhEu+4dJcyPj8dXCeq+fGBwowwRPiYsbp+TgfWN5UUs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028