UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '3oDBO2LD+LpuvINklRHnteWxSkATUfFyAl1SSv7f3As='
WHERE
key_id = 'aa372ec9937b7a716d6e55268662ae533683e6600b5fd32e96a5e6b954396145'
AND (
token = '3oDBO2LD+LpuvINklRHnteWxSkATUfFyAl1SSv7f3As='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)