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