UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'N1ed0xNzIM8NsLC+7Pm4KGJWkGdOWi9kNdZYAX4rWFk=' 
WHERE 
  key_id = 'a766af100f97a35ae3464bf0487fac6859b44793a91aa38f58fdf097d6a3dc61' 
  AND (
    token = 'N1ed0xNzIM8NsLC+7Pm4KGJWkGdOWi9kNdZYAX4rWFk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035