UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'ZBxBFrt9ncGEUGW1gcCa6LL9MFQG5i2vKfTFLvRZ9wY='
WHERE
key_id = '17b054225bd9458ce670abbfb76ef0d66d07c34c8e4c3b96aea566af711db671'
AND (
token = 'ZBxBFrt9ncGEUGW1gcCa6LL9MFQG5i2vKfTFLvRZ9wY='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)