UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'LckiJtIpiofy2JhxC/sgEbPmbIjJ2oee5h1DnhwJUFM=' 
WHERE 
  key_id = '339b89cce2615fe2d213511909b2d32d5956c1a37ca5022a0a9decb89abbd164' 
  AND (
    token = 'LckiJtIpiofy2JhxC/sgEbPmbIjJ2oee5h1DnhwJUFM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037