UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'wMYr1TNfYJv8ekA+oPl1EL+LE++Jq4bkl5Ngnv5+yDU=' 
WHERE 
  key_id = '18b535e1d4d064b39c17a396d0739012913f171395040693af9395fde41870d6' 
  AND (
    token = 'wMYr1TNfYJv8ekA+oPl1EL+LE++Jq4bkl5Ngnv5+yDU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00045