UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'RiGy16IcLjQ2Fi19eXNPccFs3NSsu0YueKhqrsqRMhw='
WHERE
key_id = '39bc9838d31bd460ec7a8160f429ba352c5093734985fda44a083f24a58a5dad'
AND (
token = 'RiGy16IcLjQ2Fi19eXNPccFs3NSsu0YueKhqrsqRMhw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)