UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'j1gb1sYMxkMcHmuTyUQ5y5uBdN5QqAJRvVohDd9Hq9E='
WHERE
key_id = 'ad8edb8f2b73935fe022d2f5ef65b7df8d30989b40d1d7c6613e53415d6bd946'
AND (
token = 'j1gb1sYMxkMcHmuTyUQ5y5uBdN5QqAJRvVohDd9Hq9E='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)