UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'lEgNa4bZeJOkJ70TZKMW7y/svcDf1Zl7Mlhmfi57H48='
WHERE
key_id = 'e9c5eabb419fb35a56739f2fb053ed2ca9a573ba2711129a6a53eb9825f586e0'
AND (
token = 'lEgNa4bZeJOkJ70TZKMW7y/svcDf1Zl7Mlhmfi57H48='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)