UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'PL1VuKFOVL5lhQdF2OeyBBbENMctvU6qUC7MhVcAFD8='
WHERE
key_id = '063c16b1ea15c804eda223f5578d416492359938a65ea2a597458740b4856fcb'
AND (
token = 'PL1VuKFOVL5lhQdF2OeyBBbENMctvU6qUC7MhVcAFD8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)