UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'gLthf8QoUlJn5AgE5b96RTwpySi3G+b6M0wie0DIx+0='
WHERE
key_id = '8762d2a92d9c98e98633279f022c90b115b7a7046a7e156e74ee7d117d59d644'
AND (
token = 'gLthf8QoUlJn5AgE5b96RTwpySi3G+b6M0wie0DIx+0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)