UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '8ErO4c5rV3zYFsUO6VyKKcb+7joNVZmjqpLE561Dm/o='
WHERE
key_id = 'd847b781f88495ef6ebe9f7fc132dae8f2449128ff961ec647fef982010f831e'
AND (
token = '8ErO4c5rV3zYFsUO6VyKKcb+7joNVZmjqpLE561Dm/o='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)