UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '9YZwNa8tjO0tyWiN2TmD2xmbRLDrmkT598kcDEPaGS4='
WHERE
key_id = '413a78c8a51c1512e649a7660d631a2dd28d457f53de4300e5e6c038bcada49c'
AND (
token = '9YZwNa8tjO0tyWiN2TmD2xmbRLDrmkT598kcDEPaGS4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)