UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'wKtdXUuqS7+/pssEscEQiCIkmM1xan12RBwEK9toHlE=' 
WHERE 
  key_id = 'fe8a494b92509c41616a462108c6df9f053d86fdd808ead67e5857d18ece1171' 
  AND (
    token = 'wKtdXUuqS7+/pssEscEQiCIkmM1xan12RBwEK9toHlE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00039