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