UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'sT6RN3ADjPSctFnSQrruVY66caXYuGP2nuZRTEvO2S4=' 
WHERE 
  key_id = '79edd78c877aa4de9f444025dd96b0d4223b52f056e8095115a2ddb43047ed11' 
  AND (
    token = 'sT6RN3ADjPSctFnSQrruVY66caXYuGP2nuZRTEvO2S4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031