UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'aVQZBgVn3AeIzFwGEjJsaeJ9Bh4faVEXiNiyYxNFbbQ=' 
WHERE 
  key_id = '4dd5dc771708c73497c5ddc0b940b3572bc2144ebbc9668e20e588426e63fb2a' 
  AND (
    token = 'aVQZBgVn3AeIzFwGEjJsaeJ9Bh4faVEXiNiyYxNFbbQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00048