UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'x722VSUpiPRzYdnaZEsq/bXAT9MVng6waQg2K3AybkU=' 
WHERE 
  key_id = '49dfab8e579d2266c94ea4951fbc1e476d08838a7602aa1fe1f7edd339418697' 
  AND (
    token = 'x722VSUpiPRzYdnaZEsq/bXAT9MVng6waQg2K3AybkU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031