UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'QgUDB7vbCdVzPYzeF7I+TomffOipAj9MFSc/QkSgd1w='
WHERE
key_id = 'a5e09b961c1103a3f468909aa220cfa7332c6f3c7e6d636642ecd8b84e8ed344'
AND (
token = 'QgUDB7vbCdVzPYzeF7I+TomffOipAj9MFSc/QkSgd1w='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)