UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'XBU299kzdRF13S05Y6Zdbuu9KfMqabMLCy6Qd/xJT5o='
WHERE
key_id = 'b9bedc8340d28729ebf2c39dbd6ae15ef6d86cfd7861b5185cfc080afbc8c1b7'
AND (
token = 'XBU299kzdRF13S05Y6Zdbuu9KfMqabMLCy6Qd/xJT5o='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)