UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Zv9CL+fY3oyVDPS1RY0t6vTmlKm6tBON49MxBUm+ReE=' 
WHERE 
  key_id = 'd62670cd26c7853a21bfcda7dc58ba1230daa28314414a3abad37987f9b165e5' 
  AND (
    token = 'Zv9CL+fY3oyVDPS1RY0t6vTmlKm6tBON49MxBUm+ReE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029