UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'qJXgijk8ldBCECGw0sl67u84ICibOAErxu2lP8Wd/Fs='
WHERE
key_id = '7217b35eef61b6b4097cf364a139c7a3768c9e84d89492d37d1d7af06ae81bc5'
AND (
token = 'qJXgijk8ldBCECGw0sl67u84ICibOAErxu2lP8Wd/Fs='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)