UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '7UVhuuMw0zgywPdiKo12NZSXMvb1LnVXcDoSBlYb5mQ=' 
WHERE 
  key_id = '921e348599ac8320f4ef77b8091890d4dfaddf03f5db4116f684371b39af863c' 
  AND (
    token = '7UVhuuMw0zgywPdiKo12NZSXMvb1LnVXcDoSBlYb5mQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00024