UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'v7v7KupBl+e5EOkILvfGjd8FqQ3daAKFHdplF+kqu7c=' 
WHERE 
  key_id = 'dd0c7078364cdd0e2cc5aa7e7250dbb2e82947139d41d91c6e4ae6fddcceebb6' 
  AND (
    token = 'v7v7KupBl+e5EOkILvfGjd8FqQ3daAKFHdplF+kqu7c=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034