UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '0Urmxj3DIz0Gmd8o3ie9Reys/vV/wZIvOx8Mt8WJ7xw='
WHERE
key_id = 'a17becc0173a9206177ef1d947b2c11a6abc8ab2a7228ece9e7cfc4841d5c9ae'
AND (
token = '0Urmxj3DIz0Gmd8o3ie9Reys/vV/wZIvOx8Mt8WJ7xw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)