UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'csWXKHCvcE98RfBa0/LPLcajKpHOmJGQPVJys/FWAN8=' 
WHERE 
  key_id = '14e8883ebea8e9f997ee0b606761ac0d71ac51ff3ead893b065c9f7cc6e1d16f' 
  AND (
    token = 'csWXKHCvcE98RfBa0/LPLcajKpHOmJGQPVJys/FWAN8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032