UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'g3LGb/il2vsKX7IzCnwy+VgO01bvdxe4jjpIg27P9e4='
WHERE
key_id = 'e4f7b9cc0455ecadcc22f3487f174a622a1160655b9a8872e6346127e76b546d'
AND (
token = 'g3LGb/il2vsKX7IzCnwy+VgO01bvdxe4jjpIg27P9e4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)