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