UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'FyQBvBlPE7xjH33dBU8gZHt4GJqUhWeFLqE8ZCmLr40='
WHERE
key_id = '01399da5f7fef66fefd1afd17d382a17f0edd5c4637eee6115c9a720143328b8'
AND (
token = 'FyQBvBlPE7xjH33dBU8gZHt4GJqUhWeFLqE8ZCmLr40='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)