UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'jH0pgNE2CCW+rgnFzZCdg9Az0wwCbvusSSKyI22sIW4='
WHERE
key_id = 'ca39568ab1fdc02c7644e2124ac789f4440a84f3504863459692b557f1d1b6b4'
AND (
token = 'jH0pgNE2CCW+rgnFzZCdg9Az0wwCbvusSSKyI22sIW4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)