UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'dfiijMSM6fiBzv38k2QNHEMP1nkLn7xOH72NoJ1owM4='
WHERE
key_id = '7d8e333f81882559c07cb646591da53595b6f79cc2bf5ca9f181a4926adaf9df'
AND (
token = 'dfiijMSM6fiBzv38k2QNHEMP1nkLn7xOH72NoJ1owM4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)