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