UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '6t/gxbvG5zIsw7BJ3A74JT0BoUI//nMV9DJ7X8kbbSI='
WHERE
key_id = 'b164c7ba1cf85318ebafa89562d6dd0c0ebf7b4232fc8f83c08d7f6fdd011368'
AND (
token = '6t/gxbvG5zIsw7BJ3A74JT0BoUI//nMV9DJ7X8kbbSI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)