UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'X8sczJhAtH8U4hSo1DK3IEfs7Q055bsj4NpIjlsi4z8='
WHERE
key_id = 'b2ce503eae31fd46ecb910b4c8a66745bbe96fbef360d16506cf7e2457509ef8'
AND (
token = 'X8sczJhAtH8U4hSo1DK3IEfs7Q055bsj4NpIjlsi4z8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)