UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'sCqMREfkhPRYJ1XrToEXgeDu7cFHyPrTWhDeDJ3YvpE=' 
WHERE 
  key_id = '20eb17535fae64686ef0964b8ddbf290fc397ed4974698fe2533cded24e360a3' 
  AND (
    token = 'sCqMREfkhPRYJ1XrToEXgeDu7cFHyPrTWhDeDJ3YvpE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034