UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'HY3Bd5DTwyiyhzk1x498KSQjqWmbiG6zIS4O76MAMfs=' 
WHERE 
  key_id = '769f06daabd269f5b4e24c25b2b183e1118f054bbdf99f0078735d35ab8c86df' 
  AND (
    token = 'HY3Bd5DTwyiyhzk1x498KSQjqWmbiG6zIS4O76MAMfs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035