UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Raqm+kWbiSNPLDPyd/LL1aM/xcdshcNOyg8p+hfcFgk=' 
WHERE 
  key_id = 'b6722301b5a1ff032419084c7b1bafa2c26bad084db7af81b049dd82ac5a11ed' 
  AND (
    token = 'Raqm+kWbiSNPLDPyd/LL1aM/xcdshcNOyg8p+hfcFgk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00044