UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'TzZMz3e1hb9eUmm3T85vXle/5VHmgnOqMl7g8NKta0s='
WHERE
key_id = '1f6d9983c2c471e1913a8add767d2c129f9d63bef30073bdc56a1b4e11fe2604'
AND (
token = 'TzZMz3e1hb9eUmm3T85vXle/5VHmgnOqMl7g8NKta0s='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)