UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'j9NQKN+b9vGvZRvG73oe+nGqqoaagmgHY0A99byCgIM='
WHERE
key_id = 'f1c16fbf28730230944511f6f4071940d161d0fba77fdcfc692ed027a3105f07'
AND (
token = 'j9NQKN+b9vGvZRvG73oe+nGqqoaagmgHY0A99byCgIM='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)