UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'erDGYmP8MFxTv/aZkvzNmhYxQbOgfg8VhIxxupLi/Zc='
WHERE
key_id = '246e43d67a55dbeb01f14800f16ef6d16f1234a21b3b7025f4262fe325795738'
AND (
token = 'erDGYmP8MFxTv/aZkvzNmhYxQbOgfg8VhIxxupLi/Zc='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)