UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'on4K7uU3mLkfo2Uqa/VvNtkh2gt/erQ/yyXOii3+N8Y=' 
WHERE 
  key_id = '1a70e7ba236fe403b5082538f5f8e85eff6af464c3f202f8c6fc16c6007fca2b' 
  AND (
    token = 'on4K7uU3mLkfo2Uqa/VvNtkh2gt/erQ/yyXOii3+N8Y=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036