UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '2Foc8iOZhOLEH2tn4cskzhpcm8NiMeLT11FFWikYaIE='
WHERE
key_id = 'b63bc1799c7df66db943067c16611e1c6faf84501832dd9da634c0e2c6e05700'
AND (
token = '2Foc8iOZhOLEH2tn4cskzhpcm8NiMeLT11FFWikYaIE='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)