UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '6yfHXJXiMr1Ss8S4LCC11ud7Tyf2tOVrg28lFfJxapU='
WHERE
key_id = 'ab60e8760e3f58c0052b911c40dd35b1346dff09ef42e6e467f070bca9599728'
AND (
token = '6yfHXJXiMr1Ss8S4LCC11ud7Tyf2tOVrg28lFfJxapU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)