UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'RGIdAeOu0BDwVhMSZSvTr1bV3ximRmZjEhYIA6eL4Yc=' 
WHERE 
  key_id = '86197294a1287d1022b267e1768659fba58f84d552f3731a0b803b9114ecf598' 
  AND (
    token = 'RGIdAeOu0BDwVhMSZSvTr1bV3ximRmZjEhYIA6eL4Yc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030