UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'BKpo3Krqte7u05D/qFzwTes9vSy5xdvM0gqiEaufQfM='
WHERE
key_id = '679b0ba79af588010e5bc90b7c4552551f0f65a00b4be7d6451b078a90deecbe'
AND (
token = 'BKpo3Krqte7u05D/qFzwTes9vSy5xdvM0gqiEaufQfM='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)