UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'z+q6bE9oZVdOZy1aGZtFhRt5DMp1TSz/JDZhAfaLnR0=' 
WHERE 
  key_id = 'f79834bf41fe58f18c383c4f1f8b868edfc151b169981d7a3ab9be87a5b320fd' 
  AND (
    token = 'z+q6bE9oZVdOZy1aGZtFhRt5DMp1TSz/JDZhAfaLnR0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032