UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'lS4hb2uyHJx4Uwm23xgMTcYKU/JjmmYr0uQsYktvwuI=' 
WHERE 
  key_id = '1c18d2a9da2f9cb0e7a89271862ea0cacec73ff832e28aeb9a6d7579f1d0731c' 
  AND (
    token = 'lS4hb2uyHJx4Uwm23xgMTcYKU/JjmmYr0uQsYktvwuI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00042