UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'XTruFTC6RALCG0ILgvLxQezMoVXPubmI67xI/MvTDv8=' 
WHERE 
  key_id = 'a30acd1a681f07209a15f6ba48c4a1438a8f5e7bae0416eed6193d128bba65ff' 
  AND (
    token = 'XTruFTC6RALCG0ILgvLxQezMoVXPubmI67xI/MvTDv8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034