UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'DpC5hLjlo7SGxmSAEFmXH7xXiZwtT6stW+BcB3MB4mQ=' 
WHERE 
  key_id = '1afe2e0ef6dd34c38cfe29c97de6b4a915a1d99c48eb151646d123f14c72a6bd' 
  AND (
    token = 'DpC5hLjlo7SGxmSAEFmXH7xXiZwtT6stW+BcB3MB4mQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023