UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'UhldMbT0T1lnmtDkzUuDaZaDLJl1+qyyi2ehN3pjK1w=' 
WHERE 
  key_id = '9801cc8bfb75c4ee535786b88d082e308e5515b0969a85f98218a18e7a3ca3b0' 
  AND (
    token = 'UhldMbT0T1lnmtDkzUuDaZaDLJl1+qyyi2ehN3pjK1w=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036