UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '5wSqTmCYSt4349N5NeK/EaqdhKvVam2/P0dMF88z87A='
WHERE
key_id = '1a768874cbb7270ee09a46ebdd19a40a5126663ca86f735fb8a06f93df4a2dc7'
AND (
token = '5wSqTmCYSt4349N5NeK/EaqdhKvVam2/P0dMF88z87A='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)