UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'WVSfnc3k3lW1hoKDGhL6vYy/2jTNCvQ1BYo0lSwzRHk=' 
WHERE 
  key_id = '990d03a22521aee70364e295ff05ec0ef9b46a85aae5fe3980d36b9da20af185' 
  AND (
    token = 'WVSfnc3k3lW1hoKDGhL6vYy/2jTNCvQ1BYo0lSwzRHk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032