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