UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'WjjqgDw+1OB9o2gocGtdGOTJQxNVfg6VfWQvyCL6mGg=' 
WHERE 
  key_id = '4c85bd52e100c10e24f47c814eb5a4caed17fa488316cabdb4f876f6d61a29c4' 
  AND (
    token = 'WjjqgDw+1OB9o2gocGtdGOTJQxNVfg6VfWQvyCL6mGg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00068