UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'TmmBxJ45Kk+rqUq+HeGRckvZyhYRtEc/EeS/cgcXTfo=' 
WHERE 
  key_id = '686b252197513953b4b4a2bd96e4b04f315f336092c53cb3d48fa1144736cfc9' 
  AND (
    token = 'TmmBxJ45Kk+rqUq+HeGRckvZyhYRtEc/EeS/cgcXTfo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029