UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'zC7xVhD0Du7w+UmHc6aduFxbToEtXjjJ63rzPk3lDSI='
WHERE
key_id = 'aee56dd7393b9fc901dfb993dc5d7290ddc94f39db797a7b95404f0979796495'
AND (
token = 'zC7xVhD0Du7w+UmHc6aduFxbToEtXjjJ63rzPk3lDSI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)