UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'l1X+mLpKsZzrdOiCHp0AaDeBHgN3RBdDD0JhxRGA3r0='
WHERE
key_id = 'f0efbbfdf63bea74f0b42d1929299c7b1ffae02249080c3b44a4b3964ef23a55'
AND (
token = 'l1X+mLpKsZzrdOiCHp0AaDeBHgN3RBdDD0JhxRGA3r0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)